/**
 * 
 */
package com.tvshows.front.controllers.main;

import com.tvshows.front.controllers.FrontController;
import com.tvshows.front.controllers.favorite.FavoriteController;
import com.tvshows.front.controllers.recap.RecapController;
import com.tvshows.front.factory.TypeUI;
import com.tvshows.front.factory.ViewFactory;
import com.tvshows.front.ui.main.MainUI;

/**
 * @author tMidy
 * <p>
 * The MainController
 * </p>
 */
public class MainController
    implements FrontController
{

    /**
     * The main view
     */
    private MainUI mainView;

    /**
     * The favorite Controller
     */
    private FavoriteController favoriteController;

    /**
     * The recap controller
     */
    private RecapController recapController;

    /**
     * Constructeur
     */
    public MainController()
    {
        mainView = (MainUI) ViewFactory.getUI( TypeUI.MAIN_VIEW );
        favoriteController = new FavoriteController();
        recapController = new RecapController();
        favoriteController.loadFavorites();
        initFormData();
        initComposites();
        mainView.layout();
    }

    /**
     * @see com.tvshows.front.controllers.FrontController#initFormData()
     */
    @Override
    public void initFormData()
    {
        mainView.initFormData();
        favoriteController.initFormData();
        recapController.initFormData();
    }

    /**
     * @see com.tvshows.front.controllers.FrontController#initComposites()
     */
    @Override
    public void initComposites()
    {
        mainView.setRecapView( recapController.getRecapView() );
        favoriteController.initComposites();
        mainView.setFavoriteView( favoriteController.getFavoriteView() );

        mainView.initComposites();

    }

    /**
     * @return the mainView
     */
    public MainUI getMainView()
    {
        return mainView;
    }

    /**
     * @param mainView the mainView to set
     */
    public void setMainView( MainUI mainView )
    {
        this.mainView = mainView;
    }

    /**
     * @return the favoriteController
     */
    public FavoriteController getFavoriteController()
    {
        return favoriteController;
    }

    /**
     * @param favoriteController the favoriteController to set
     */
    public void setFavoriteController( FavoriteController favoriteController )
    {
        this.favoriteController = favoriteController;
    }

    /**
     * @return the recapController
     */
    public RecapController getRecapController()
    {
        return recapController;
    }

    /**
     * @param recapController the recapController to set
     */
    public void setRecapController( RecapController recapController )
    {
        this.recapController = recapController;
    }

}
